package com.example.downloaddemo.downloader;

import java.io.Serializable;
import java.util.Objects;

public class DownloadEntry implements Serializable {
    public DownloadEntry() {
    }

    public DownloadEntry(int id, String name) {
        this.id = id;
        this.name = name;
    }

    private int id;
    private String name;
    private String url;

    public enum DownloadStatus {waiting, downloading, pause, resume, cancel, completed}

    ;

    public DownloadStatus status;

    public int progress;
    public int totalLength;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getProgress() {
        return progress;
    }

    public void setProgress(int progress) {
        this.progress = progress;
    }

    public int getTotalLength() {
        return totalLength;
    }

    public void setTotalLength(int totalLength) {
        this.totalLength = totalLength;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DownloadEntry that = (DownloadEntry) o;
        return id == that.id;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
